<!--
*Author：jxx
 *Contact：283591387@qq.com
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/salesinfo/sales/q_sales.js此处编写
 -->
<template>
    <view-grid ref="grid"
               :columns="columns"
               :detail="detail"
               :editFormFields="editFormFields"
               :editFormOptions="editFormOptions"
               :searchFormFields="searchFormFields"
               :searchFormOptions="searchFormOptions"
               :table="table"
               :extend="extend">
    </view-grid>
</template>
<script>
    import extend from "@/extension/salesinfo/sales/q_sales.js";
    import { ref, defineComponent } from "vue";
    export default defineComponent({
        setup() {
            const table = ref({
                key: 'Sales',
                footer: "Foots",
                cnName: '销售单',
                name: 'sales/q_sales',
                url: "/q_sales/",
                sortName: "Voucher_sub"
            });
            const editFormFields = ref({"Voucher_sub":"","Client":"","Sales_contract_voucher_sub":"","Project_name":"","Goods_num":"","Total_price":"","Zhibao_date":"","Tax_rate":"","Install_service":"","Install_status":"","WHSE_no":"","Attachment":"","Image":"","Remark":"","Zhibao_state":"","Sales_contract_id":""});
            const editFormOptions = ref([[{"title":"单据编码","field":"Voucher_sub","type":"text"},
                               {"dataKey":"审核通过客户","data":[],"title":"客户","required":true,"field":"Client","type":"select"},
                               {"title":"销售合同","field":"Sales_contract_voucher_sub","colSize":6,"type":"text"}],
                              [{"title":"销售数量","required":true,"field":"Goods_num","type":"text"},
                               {"title":"销售总价","required":true,"field":"Total_price","colSize":3,"type":"text"},
                               {"title":"项目名称","field":"Project_name","type":"text"},
                               {"title":"质保截至时间","field":"Zhibao_date","type":"datetime"}],
                              [{"dataKey":"税率","data":[],"title":"销售税率","required":true,"field":"Tax_rate","colSize":3,"type":"select"},
                               {"dataKey":"一级仓库","data":[],"title":"销售机构","required":true,"field":"WHSE_no","type":"select"},
                               {"dataKey":"Install_service","data":[],"title":"安装服务","field":"Install_service","type":"select"},
                               {"dataKey":"安装状态","data":[],"title":"安装状态","field":"Install_status","type":"select"}],
                              [{"title":"备注","field":"Remark","colSize":6,"type":"textarea"},
                               {"title":"附件","field":"Attachment","type":"file"},
                               {"title":"图片","field":"Image","type":"img"}],
                              [{"dataKey":"Zhibao_state","data":[],"title":"质保状态","field":"Zhibao_state","type":"select"},
                               {"title":"销售合同ID","field":"Sales_contract_id","type":"text"}]]);
            const searchFormFields = ref({"Voucher_sub":"","Client":"","Project_name":"","Sales_contract_voucher_sub":"","Tax_rate":"","Zhibao_date":"","Zhibao_state":"","Install_status":"","WHSE_no":"","AuditStatus":"","AuditDate":"","CreateDate":""});
            const searchFormOptions = ref([[{"title":"单据编码","field":"Voucher_sub","type":"like"},{"title":"销售合同","field":"Sales_contract_voucher_sub","type":"like"},{"dataKey":"审核通过客户","data":[],"title":"客户","field":"Client","type":"select"},{"title":"项目名称","field":"Project_name","type":"like"}],[{"dataKey":"一级仓库","data":[],"title":"销售机构","field":"WHSE_no","type":"select"},{"dataKey":"税率","data":[],"title":"销售税率","field":"Tax_rate","type":"select"},{"dataKey":"Zhibao_state","data":[],"title":"质保状态","field":"Zhibao_state","type":"select"},{"dataKey":"安装状态","data":[],"title":"安装状态","field":"Install_status","type":"select"}],[{"dataKey":"audit","data":[],"title":"审核状态","field":"AuditStatus","type":"select"},{"title":"质保截至时间","field":"Zhibao_date","type":"datetime"},{"title":"审核时间","field":"AuditDate","type":"datetime"},{"title":"创建时间","field":"CreateDate","type":"datetime"}]]);
            const columns = ref([{field:'Voucher_sub',title:'单据编码',type:'string',link:true,width:150,align:'left',sort:true},
                       {field:'Client',title:'客户',type:'string',bind:{ key:'审核通过客户',data:[]},width:80,require:true,align:'left'},
                       {field:'Project_name',title:'项目名称',type:'string',width:220,align:'left'},
                       {field:'Sales_contract_voucher_sub',title:'销售合同',type:'string',width:150,align:'left'},
                       {field:'Goods_num',title:'销售数量',type:'float',width:80,require:true,align:'left'},
                       {field:'Total_price',title:'销售总价',type:'decimal',width:110,require:true,align:'left'},
                       {field:'Tax_rate',title:'销售税率',type:'decimal',bind:{ key:'税率',data:[]},width:110,require:true,align:'left'},
                       {field:'Zhibao_date',title:'质保截至时间',type:'datetime',width:150,align:'left',sort:true},
                       {field:'Zhibao_state',title:'质保状态',type:'int',bind:{ key:'Zhibao_state',data:[]},width:80,align:'left'},
                       {field:'Install_service',title:'安装服务',type:'int',bind:{ key:'Install_service',data:[]},width:80,align:'left'},
                       {field:'Install_status',title:'安装状态',type:'int',bind:{ key:'安装状态',data:[]},width:80,align:'left'},
                       {field:'WHSE_no',title:'销售机构',type:'string',bind:{ key:'一级仓库',data:[]},width:110,require:true,align:'left'},
                       {field:'AuditStatus',title:'审核状态',type:'int',bind:{ key:'audit',data:[]},width:110,align:'left'},
                       {field:'Attachment',title:'附件',type:'file',width:110,align:'left'},
                       {field:'Image',title:'图片',type:'img',width:110,align:'left'},
                       {field:'Remark',title:'备注',type:'string',width:220,align:'left'},
                       {field:'AuditDate',title:'审核时间',type:'datetime',width:150,align:'left',sort:true},
                       {field:'AuditID',title:'审核人员id',type:'int',width:110,hidden:true,align:'left'},
                       {field:'Auditor',title:'审核人员',type:'string',width:120,hidden:true,align:'left'},
                       {field:'CreateID',title:'创建人员id',type:'int',width:100,hidden:true,align:'left'},
                       {field:'Creator',title:'创建人员',type:'string',width:100,align:'left'},
                       {field:'CreateDate',title:'创建时间',type:'datetime',width:150,align:'left',sort:true},
                       {field:'ModifyID',title:'修改人员id',type:'int',width:100,hidden:true,align:'left'},
                       {field:'Modifier',title:'修改人员',type:'string',width:100,hidden:true,align:'left'},
                       {field:'ModifyDate',title:'修改时间',type:'datetime',width:150,hidden:true,align:'left',sort:true},
                       {field:'Sales',title:'ID',type:'guid',width:110,hidden:true,require:true,align:'left'},
                       {field:'Sales_contract_id',title:'销售合同ID',type:'guid',width:110,hidden:true,align:'left'}]);
            const detail = ref({
                cnName: "销售单明细",
                table: "q_salesList",
                columns: [{field:'WHSE_name',title:'库位名称',type:'string',bind:{ key:'库位编码',data:[]},width:110,edit:{type:'select'},align:'left',sort:true},
                       {field:'Sales_contract_voucher_sub',title:'销售合同编码',type:'string',width:150,align:'left'},
                       {field:'Goods_sub',title:'商品编码',type:'string',width:110,align:'left'},
                       {field:'Goods_name',title:'商品名称',type:'string',width:220,align:'left'},
                       {field:'Goods_size',title:'规格型号',type:'string',width:110,align:'left'},
                       {field:'AvailableQuantity',title:'可用数量',type:'float',width:110,hidden:true,align:'left'},
                       {field:'Goods_num',title:'销售数量',type:'float',width:80,edit:{type:'number'},require:true,align:'left'},
                       {field:'Goods_price',title:'销售单价',type:'decimal',width:110,edit:{type:'number'},require:true,align:'left'},
                       {field:'Total_price',title:'销售金额',type:'decimal',width:110,require:true,align:'left'},
                       {field:'Tax_exclusive_contract_total_price',title:'销售无税金额',type:'decimal',width:110,require:true,align:'left'},
                       {field:'Cost_price',title:'成本价',type:'decimal',width:110,hidden:true,require:true,align:'left'},
                       {field:'Cost_price_total_price',title:'成本金额',type:'decimal',width:110,hidden:true,require:true,align:'left'},
                       {field:'Tax_exclusive',title:'无税成本',type:'decimal',width:110,hidden:true,require:true,align:'left'},
                       {field:'Tax_exclusive_total_price',title:'无税成本金额',type:'decimal',width:110,hidden:true,require:true,align:'left'},
                       {field:'Logistics_status',title:'发货状态',type:'int',bind:{ key:'发货状态',data:[]},width:80,hidden:true,align:'left'},
                       {field:'Install_status',title:'安装状态',type:'int',bind:{ key:'安装状态',data:[]},width:80,hidden:true,align:'left'},
                       {field:'SalesList',title:'ID',type:'guid',width:110,hidden:true,readonly:true,require:true,align:'left'},
                       {field:'Sales',title:'父级ID',type:'guid',width:110,hidden:true,align:'left'},
                       {field:'SN',title:'SN码',type:'string',width:110,edit:{type:'text'},align:'left'},
                       {field:'Remark',title:'备注',type:'string',width:220,edit:{type:'text'},align:'left'},
                       {field:'AuditDate',title:'审核时间',type:'datetime',width:150,hidden:true,align:'left',sort:true},
                       {field:'AuditStatus',title:'审核状态',type:'int',width:110,hidden:true,align:'left'},
                       {field:'AuditID',title:'审核人员id',type:'int',width:110,hidden:true,align:'left'},
                       {field:'Auditor',title:'审核人员',type:'string',width:120,hidden:true,align:'left'},
                       {field:'CreateID',title:'创建人员id',type:'int',width:100,hidden:true,align:'left'},
                       {field:'Creator',title:'创建人员',type:'string',width:100,hidden:true,align:'left'},
                       {field:'CreateDate',title:'创建时间',type:'datetime',width:150,hidden:true,align:'left',sort:true},
                       {field:'ModifyID',title:'修改人员id',type:'int',width:100,hidden:true,align:'left'},
                       {field:'Modifier',title:'修改人员',type:'string',width:100,hidden:true,align:'left'},
                       {field:'ModifyDate',title:'修改时间',type:'datetime',width:150,hidden:true,align:'left',sort:true},
                       {field:'sales_contractList_ID',title:'合同明细表ID',type:'guid',width:110,hidden:true,align:'left'},
                       {field:'Inventory_ID',title:'库存ID',type:'guid',width:110,hidden:true,align:'left'},
                       {field:'Delivery_requestList',title:'发货明细ID',type:'guid',width:110,hidden:true,align:'left'}],
                sortName: "Voucher_sub",
                key: "SalesList"
            });
            return {
                table,
                extend,
                editFormFields,
                editFormOptions,
                searchFormFields,
                searchFormOptions,
                columns,
                detail,
            };
        },
    });
</script>
